//
//  ZRNetworkTool.m
//  Findif
//
//  Created by Cicel Chen on 2018/10/25.
//  Copyright © 2018年 Cicel Chen. All rights reserved.
//

#import "ZRNetworkTool.h"
#import <CommonCrypto/CommonDigest.h>
//#import "YTKKeyValueStore.h"

@implementation ZRNetworkTool

//static YTKKeyValueStore *_store;
//static NSString *const  httpCache = @"NetworkCache";
//static BOOL    _isHasNetWork;

- (instancetype)init{
    if (self = [super init]) {
        
        NSURL *url = [NSURL URLWithString:BASEURLSTR];
        _manager = [[AFHTTPSessionManager manager]initWithBaseURL:url];
        //        _manager.requestSerializer = [AFJSONRequestSerializer serializer];
        _manager.responseSerializer = [AFHTTPResponseSerializer serializer];
        
        _manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/json", @"text/plain", @"text/html", nil];
        
    }
    return self;
}

#pragma mark - 实例化单例子
+ (instancetype)sharedTool{
    
    static ZRNetworkTool *instance;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance =  [[ZRNetworkTool alloc] init];
    });
    
    [instance checkNetworkStatus];
    return instance;
}



- (void)checkNetworkStatus {
    
    [[AFNetworkReachabilityManager sharedManager] startMonitoring];
    [[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
        switch (status) {
            case AFNetworkReachabilityStatusUnknown:{
                //                [AutoAlertView showMessage:@"您正处在未知网络环境"];
//                _isHasNetWork = NO;
//                [self->_manager.requestSerializer setCachePolicy:NSURLRequestReloadIgnoringCacheData];
                break;
            }
            case AFNetworkReachabilityStatusNotReachable:{

//                _isHasNetWork = NO;
//                [self->_manager.requestSerializer setCachePolicy:NSURLRequestReturnCacheDataDontLoad];
                break;
            }
            case AFNetworkReachabilityStatusReachableViaWiFi:{
                
//                _isHasNetWork = YES;
//                [self->_manager.requestSerializer setCachePolicy:NSURLRequestReloadIgnoringCacheData];
                break;
            }
            case AFNetworkReachabilityStatusReachableViaWWAN:{
                //                [AutoAlertView showMessage:@"您正处在移动网络环境"];
//                _isHasNetWork = YES;
//                [self->_manager.requestSerializer setCachePolicy:NSURLRequestReloadIgnoringCacheData];
                
                break;
            }
            default:
                break;
        }
    }];
}



#pragma mark - 基础
- (void)requestWithType:(RequestType)type andUrl:(NSString *)url andParameters:(NSDictionary*)params andTimeOut:(double)timeOut resultWithBlock:(result)finishBlock
{
    
    if(!url || [url length] == 0)
    {//如果传入的url为空,这时候
        finishBlock(NO,@"请求地址不能为空");
        return;
    }
    
    //设置超时时间
    _manager.requestSerializer.timeoutInterval = timeOut;
    //拼接URL
    NSString *urlStr = [NSString stringWithFormat:@"%@%@",BASEURLSTR,url];
    NSLog(@"url%@",urlStr);
    
    
    NSString *token = [[NSUserDefaults standardUserDefaults] objectForKey:ZRToken];
    if(token.length != 0 && ![url isEqualToString:@"/index/Nanjinliuhe/getService"] && ![url isEqualToString:@"/index/Nanjinliuhe/getSerDet"]){
//        params[@"token"] = token;
    }
    
    
    NSLog(@"请求参数%@",params);
    
    if (type == GET) {
        _requestTask = [self.manager GET:urlStr parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
            
            finishBlock(YES,responseObject);
            
            
        } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
            
            finishBlock(NO, @"");
            NSLog(@"网络错误信息：%@",error);
            
        }];
        
    } else {
        
        if (params == nil)
        {
            finishBlock(NO,@"post请求->请传入参数");
            return;
        }
        
        _requestTask = [self.manager POST:urlStr parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
            
            finishBlock(YES, responseObject);
            
        } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
            
            finishBlock(NO, @"");
            NSLog(@"网络错误信息：%@",error);
        }];
        
    }
    
}


#pragma mark - 发送验证码
- (void)sendMsgWithPhone:(NSString *)phone resultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"phone":phone,@"templId":@"105642",@"timeStamp":dateStr};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"phone":phone,@"templId":@"105642",@"timeStamp":dateStr,@"sign":sign};
    
    [self requestWithType:POST andUrl:@"/Api/sendMsg" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 验证短信验证码
- (void)veriftCodeWithPhone:(NSString *)phone WithCode:(NSString *)code resultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"phone":phone,@"code":code,@"timeStamp":dateStr};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"phone":phone,@"code":code,@"timeStamp":dateStr,@"sign":sign};
    
    [self requestWithType:POST andUrl:@"/Api/checkMobileCode" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}


#pragma mark - 登录
- (void)loginWithPhone:(NSString *)phone WithLat:(NSString *)lat WithLon:(NSString *)lon resultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"phone":phone,@"login_type":@"2",@"timeStamp":dateStr,@"address_longitude":lon,@"address_latitude":lat};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"phone":phone,@"login_type":@"2",@"timeStamp":dateStr,@"sign":sign,@"address_longitude":lon,@"address_latitude":lat};
    
    [self requestWithType:GET andUrl:@"/Api/login" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 获取Banner图
- (void)getBannerResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    
    [self requestWithType:POST andUrl:@"/Api/getBanner" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 获取用户信息
- (void)getUserInfoResultWithUser_id:(NSString *)user_id WithExamine_user_id:(NSString *)examine_user_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
//    NSString * ID = DEF_GET_OBJECT(@"id");
    NSDictionary * dict;
    if (examine_user_id) {
       
        dict = @{@"timeStamp":dateStr,@"id":user_id,@"examine_user_id":examine_user_id};
    }else{
        
        dict = @{@"timeStamp":dateStr,@"id":user_id};
    }
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict;
    if (examine_user_id) {
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":user_id,@"examine_user_id":examine_user_id};
    }else{
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":user_id};
    }
    
    [self requestWithType:POST andUrl:@"/Api/getUserInfo" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark - 根据分类id获取商品列表
- (void)getGoodsListResultWithCategory:(NSString *)ID WithIs_merchants_get:(NSString *)is_merchants_get
                             WithBlock:(result)finishBlock;{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * userLat = DEF_GET_OBJECT(@"lat");
    NSString * userLon = DEF_GET_OBJECT(@"lon");
    NSDictionary * dict;
    if (userLat && userLon) {
       
        dict = @{@"timeStamp":dateStr,@"merchants_goods_category":ID,@"is_merchants_get":is_merchants_get,@"user_longitude":userLon,@"user_latitude":userLat,@"merchants_goods_smart_sort":@"1"};
    }else{
        
        dict = @{@"timeStamp":dateStr,@"merchants_goods_category":ID,@"is_merchants_get":is_merchants_get};
    }
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict;
    if (userLat && userLon) {
      
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_goods_category":ID,@"is_merchants_get":is_merchants_get,@"user_longitude":userLon,@"user_latitude":userLat,@"merchants_goods_smart_sort":@"1"};
    }else{
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_goods_category":ID,@"is_merchants_get":is_merchants_get};
    }
    [self requestWithType:POST andUrl:@"/Api/getGoodslist" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}


#pragma mark - 根据商铺id获取商品列表
- (void)getGoodsListResultWithShopid:(NSString *)ID WithMerchants_goods_status:(NSString *)merchants_goods_status WithIs_merchants_get:(NSString *)is_merchants_get WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"merchants_goods_merchants_id":ID,@"merchants_goods_status":merchants_goods_status,@"is_merchants_get":is_merchants_get};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_goods_merchants_id":ID,@"merchants_goods_status":merchants_goods_status,@"is_merchants_get":is_merchants_get};
    
    [self requestWithType:POST andUrl:@"/Api/getGoodslist" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
//            NSLog(@"res==%@",result);
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}


#pragma mark - 获取商品详情
- (void)getGoodsIfoResultWithGoodsID:(NSString *)ID WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"goods_id":ID};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"goods_id":ID};
    
    [self requestWithType:POST andUrl:@"/Api/getGoodsInfo" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 获取商铺列表
- (void)getShopListResultWithLat:(double)lat Withlon:(double)lon WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * latStr = [NSString stringWithFormat:@"%f",lat];
    NSString * lonStr = [NSString stringWithFormat:@"%f",lon];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"latitude":latStr,@"longitude":lonStr,@"distance":@"100"};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"latitude":latStr,@"longitude":lonStr,@"distance":@"100"};
    
    [self requestWithType:POST andUrl:@"/Api/MerchantsList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            
//            NSLog(@"res===%@",result);
            
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
  
}


#pragma mark - 获取用户收藏商品列表
- (void)getUserCollectionListResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getUserCollectionGoodsLists" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            NSLog(@"===%@",result);
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark - 用户取消收藏商品
- (void)userCancelCollectionGoodsWithGoods_id:(NSString *)goods_id ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"goods_id":goods_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"goods_id":goods_id};
    
    [self requestWithType:POST andUrl:@"/Api/userCancelCollectionGoods" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}


#pragma mark - 获取商品评价列表
- (void)getGoodsCommentsListResultWithGoodsID:(NSString *)goods_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"goods_id":goods_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"goods_id":goods_id};
    
    [self requestWithType:POST andUrl:@"/Api/getGoodsComments" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 修改个人信息
- (void)updateUserInfoWithUpdate_Class:(NSString *)update_class WithUpdate_content:(NSString *)content WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"update_class":update_class,@"update_content":content,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"update_class":update_class,@"update_content":content,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/updateUserInfo" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
//            NSLog(@"res==%@",result);
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 获取年龄列表
- (void)getAgeListResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    
    [self requestWithType:POST andUrl:@"/Api/getAge" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 获取用户相册
- (void)getUserPhotoAlbumWithUser_id:(NSString *)user_id ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getUserPhotoAlbum" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}


#pragma mark - 获取用户相册
- (void)deleteUserPhotoAlbumWithAlbum_id:(NSString *)album_id ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":album_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":album_id};
    
    [self requestWithType:POST andUrl:@"/Api/deleteUserPhotoAlbum" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}


#pragma mark - 意见反馈
- (void)userFeedBackmWithConent:(NSString *)content ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"feedback_content":content,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"feedback_content":content,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/userFeedback" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 分类列表
- (void)getCategoryResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"request_type":@"2"};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"request_type":@"2"};
    
    [self requestWithType:POST andUrl:@"/Api/getCategory" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
//            NSLog(@"res==%@",result);
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}


#pragma mark - 图片上传
- (void)uploadOneImgResultWithImg:(NSString *)img WithBlock:(result)finishBlock{
    
    NSDictionary * dict = @{@"img":img};
    
    [self requestWithType:POST andUrl:@"/Api/uploadOneImg" andParameters:dict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark - 获取商铺审核状态
- (void)getMerchantsStatusResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getMerchantsStatus" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}


#pragma mark - 验证后注册
- (void)setupResultWithPhone:(NSString *)phone WithLat:(NSString *)lat WithLon:(NSString *)lon WithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    //    NSDictionary * dict = @{@"timeStamp":dateStr};
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:4];
    
    [muDict setObject:phone forKey:@"phone"];
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:lon forKey:@"address_longitude"];
    [muDict setObject:lat forKey:@"address_latitude"];
    
    NSArray * allkeys = [dict allKeys];
    //    NSLog(@"allkeys %@",allkeys);
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/register" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            //            NSLog(@"res===%@",result);
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}


#pragma mark - 获取商品订单列表
- (void)getGoodsOrderListResultWithShopID:(NSString *)ID WithStatus:(NSString *)status WithBlock:(result)finishBlock{
    
//    _store = [[YTKKeyValueStore alloc] initDBWithName:httpCache];
//    [_store createTableWithName:httpCache];
//
//    if (_isHasNetWork) {
    
        //获取当前时间日期
        NSDate *date=[NSDate date];
        NSDateFormatter *format1=[[NSDateFormatter alloc] init];
        [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
        NSString *dateStr;
        dateStr=[format1 stringFromDate:date];
        
        NSDictionary * dict;
        if ([status isEqualToString:@"10"]) {
            
            dict = @{@"timeStamp":dateStr,@"merchants_id":ID};
        }else{
            
            dict = @{@"timeStamp":dateStr,@"merchants_id":ID,@"goods_order_status":status};
        }
        
        
        NSString * sign = [self signStr:dict];
        
        NSDictionary * resDict;
        if ([status isEqualToString:@"10"]) {
            
            resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_id":ID};
        }else{
            
            resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_id":ID,@"goods_order_status":status};
        }
        
//        NSDictionary * dataDict =   [_store getObjectById:@"/Api/getGoodsOrderList"  fromTable:httpCache];
//        if (dataDict) {
//            //        success(dataDict);
//            finishBlock(YES,dataDict);
//        }else {
    
            //        NSLog(@"params==%@",params);
            //        [[self manager] POST:url parameters:params progress:^(NSProgress * _Nonnull downloadProgress) {
            //
            //            //                    progress(downloadProgress.completedUnitCount, downloadProgress.totalUnitCount);
            //        } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
            //            [_store putObject:responseObject withId:url intoTable:httpCache];
            //            success(responseObject);
            //            NSLog(@"\nRequest success, URL: %@\n params:%@\n response:%@\n\n",url,params,responseObject);
            //        } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
            //            NSLog(@"error===%@",error);
            //            fail(error);
            //        }];
            
            [self requestWithType:POST andUrl:@"/Api/getGoodsOrderList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
     
                if (success)
                {
                    NSError *error;
                    
                    NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
                    
                    //            NSLog(@"===%@",result);
                    NSInteger code = [result[@"code"] integerValue];
                    
                    if (code == 200)
                    {
//                        [_store putObject:responseData withId:@"/Api/getGoodsOrderList" intoTable:httpCache];
                        finishBlock(YES,result);
                        
                    }else{
                        finishBlock(NO,result);
                    }
                }
                else
                {
                    finishBlock(NO,@"请求失败");
                }
            }];
//        }
//    }else{
//
//        NSDictionary *dict =   [_store getObjectById:@"/Api/getGoodsOrderList"  fromTable:httpCache];
//        if (dict) {
//            finishBlock(YES,dict);
//        }else {
//            NSLog(@"当前为无网络状态，本地也没有缓存数据");
//        }
//    }
    
    
    
}

#pragma mark - 获取用户余额
- (void)getUserBillResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getUserBill" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 用户获取商品订单列表
- (void)getGoodsOrderListResultWithUser_id:(NSString *)ID WithStatus:(NSString *)status WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];

    NSDictionary * dict;
    if ([status isEqualToString:@"10"]) {
        
        dict = @{@"timeStamp":dateStr,@"user_id":ID};
    }else{
        
        dict = @{@"timeStamp":dateStr,@"user_id":ID,@"goods_order_status":status};
    }
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict;
    if ([status isEqualToString:@"10"]) {
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":ID};
    }else{
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":ID,@"goods_order_status":status};
    }
    
    [self requestWithType:POST andUrl:@"/Api/getGoodsOrderList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            
//             NSLog(@"===%@",result);
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 获取极光IM初始化签名
- (void)getJgSignResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    
    [self requestWithType:POST andUrl:@"/Api/getJgSign" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 核销商品核销码
- (void)cancelMerchantsGoodsBarcodeResultWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * shopid = DEF_GET_OBJECT(@"shopid");
    
//    NSDictionary * dict = @{@"timeStamp":dateStr};
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:4];
    
    [muDict setObject:shopid forKey:@"merchants_id"];
    [muDict setObject:dateStr forKey:@"timeStamp"];
    
    NSArray * allkeys = [dict allKeys];
//    NSLog(@"allkeys %@",allkeys);
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
//    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/cancelMerchantsGoodsBarcode" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
//            NSLog(@"res===%@",result);
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark - 商铺添加优惠券
- (void)addMerchantsCouponsResultWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * shopid = DEF_GET_OBJECT(@"shopid");

    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:4];
    
    [muDict setObject:shopid forKey:@"merchants_id"];
    [muDict setObject:dateStr forKey:@"timeStamp"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/addMerchantsCoupons" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
                        NSLog(@"res===%@",result);
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];

}

#pragma mark - 商铺修改优惠券
- (void)editMerchantsCouponsResultWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * shopid = DEF_GET_OBJECT(@"shopid");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:4];
    
    [muDict setObject:shopid forKey:@"merchants_id"];
    [muDict setObject:dateStr forKey:@"timeStamp"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/editMerchantsCoupons" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSLog(@"res===%@",result);
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 商铺添加优惠券
- (void)getMerchantsCouponsResultWithShop_id:(NSString *)shop_id WithUser_id:(NSString *)user_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict;
    if ([user_id isEqualToString:@"no"]) {
        
        dict = @{@"timeStamp":dateStr,@"merchants_id":shop_id};
    }else{
        
        dict = @{@"timeStamp":dateStr,@"merchants_id":shop_id,@"user_id":user_id};
    }
    
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict;
    if ([user_id isEqualToString:@"no"]) {
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_id":shop_id};
    }else{
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_id":shop_id,@"user_id":user_id};
    }
    
    
    [self requestWithType:POST andUrl:@"/Api/getMerchantsCoupons" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}


#pragma mark - 商铺删除优惠券
- (void)deleteMerchantsCouponsResultWithShop_id:(NSString *)shop_id WithGoods_id:(NSString *)goods_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"merchants_id":shop_id,@"id":goods_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_id":shop_id,@"id":goods_id};
    
    [self requestWithType:POST andUrl:@"/Api/deleteMerchantsCoupons" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 修改商铺信息
- (void)editMerchantsResultWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date = [NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * shopid = DEF_GET_OBJECT(@"shopid");
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:4];
    
    [muDict setObject:shopid forKey:@"id"];
    [muDict setObject:user_id forKey:@"merchants_user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/editMerchants" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
//            NSLog(@"res===%@",result);
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 修改商铺状态
- (void)editMerchantsResultWithMerchants_status:(NSString *)merchants_status WithBlock:(result)finishBlock{
    //获取当前时间日期
    NSDate *date = [NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * shopid = DEF_GET_OBJECT(@"shopid");
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":shopid,@"merchants_status":merchants_status,@"merchants_user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"id":shopid,@"merchants_status":merchants_status,@"merchants_user_id":user_id,@"sign":sign};
    
    [self requestWithType:POST andUrl:@"/Api/editMerchantsStatus" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            //            NSLog(@"res===%@",result);
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}


#pragma mark - 商铺详情
- (void)getMerchantsInfoWithShop_id:(NSString *)shop_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];

    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":shop_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":shop_id};
    
    [self requestWithType:POST andUrl:@"/Api/MerchantsInfo" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}


#pragma mark - 搜索订单
- (void)searchMerchantsCouponsResultWithSearch_name:(NSString *)search_name WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * merchants_id = DEF_GET_OBJECT(@"shopid");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"search_name":search_name,@"merchants_id":merchants_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"search_name":search_name,@"merchants_id":merchants_id};
    
    [self requestWithType:POST andUrl:@"/Api/getGoodsOrderList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            NSLog(@"==%@",result);
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 搜索商品
- (void)searchGoodsResultWithSearch_name:(NSString *)search_name WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"search_name":search_name,@"is_merchants_get":@"0"};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"search_name":search_name,@"is_merchants_get":@"0"};
    
    [self requestWithType:POST andUrl:@"/Api/getGoodslist" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 商铺添加商品
- (void)addMerchantsGoodsResultWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * shopid = DEF_GET_OBJECT(@"shopid");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:4];
    
    [muDict setObject:shopid forKey:@"merchants_goods_merchants_id"];
    [muDict setObject:dateStr forKey:@"timeStamp"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/addMerchantsGoods" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 修改商品信息
- (void)editMerchantsGoodsResultWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * shopid = DEF_GET_OBJECT(@"shopid");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:4];
    
    [muDict setObject:shopid forKey:@"merchants_goods_merchants_id"];
    [muDict setObject:dateStr forKey:@"timeStamp"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/editMerchantsGoods" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 用户领取商铺优惠券
- (void)userReceiveMerchantsCouponsResultWithCoupon_id:(NSString *)Coupon_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"merchants_coupons_id":Coupon_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"merchants_coupons_id":Coupon_id};
    
    [self requestWithType:POST andUrl:@"/Api/userReceiveMerchantsCoupons" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark - 获取用户拥有的优惠券
- (void)getUserCouponsResultWithMerchants_id:(NSString *)merchants_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict;
    if (merchants_id) {
        
        dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"merchants_id":merchants_id};
    }else{
        
        dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    }
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict;
    if (merchants_id) {
      
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"merchants_id":merchants_id};
    }else{
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    }
    
    [self requestWithType:POST andUrl:@"/Api/getUserCoupons" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];

//            NSLog(@"res===%@",responseData);
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 获取确认订单用户拥有的优惠券
- (void)getUserCouponsResultWithMerchants_id:(NSString *)merchants_id WithGoods_Category_ID:(NSString *)goods_category_id WithGoods_type:(NSString *)goods_type WithCoods_id:(NSString *)goods_id WithGoods_field:(NSString *)goods_field WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict;
    if (goods_field) {
        
        dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"goods_type":goods_type,@"merchants_id":merchants_id,@"goods_category_id":goods_category_id,@"goods_id":goods_id,@"goods_field":goods_field};
    }else{
        
       dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"goods_type":goods_type,@"merchants_id":merchants_id,@"goods_category_id":goods_category_id,@"goods_id":goods_id};
    }
    
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict;
  
    if (goods_field) {
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"goods_type":goods_type,@"merchants_id":merchants_id,@"goods_category_id":goods_category_id,@"goods_id":goods_id,@"goods_field":goods_field};
    }else{
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"goods_type":goods_type,@"merchants_id":merchants_id,@"goods_category_id":goods_category_id,@"goods_id":goods_id};
    }
    
    [self requestWithType:POST andUrl:@"/Api/getUserCoupons" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            //            NSLog(@"res===%@",responseData);
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 获取商品拼团场次
- (void)getMerchantsGoodsFieldResultWithGoodsId:(NSString *)goods_id WithChoose_date:(NSString *)choose_date WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":goods_id,@"choose_date":choose_date};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":goods_id,@"choose_date":choose_date};
    
    [self requestWithType:POST andUrl:@"/Api/getMerchantsGoodsField" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            //            NSLog(@"res===%@",responseData);
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark - 修改商品状态
- (void)changeGoodsStatusResultWithGoods_id:(NSString *)goods_id WithMerchants_goods_status:(NSString *)merchants_goods_status WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":goods_id,@"merchants_goods_status":merchants_goods_status};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":goods_id,@"merchants_goods_status":merchants_goods_status};
    
    [self requestWithType:POST andUrl:@"/Api/changeGoodsStatus" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            //            NSLog(@"res===%@",responseData);
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark - 获取商铺余额
- (void)getMerchantsBillResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * shop_id = DEF_GET_OBJECT(@"shopid");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"merchants_id":shop_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_id":shop_id};
    
    [self requestWithType:POST andUrl:@"/Api/getMerchantsBill" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            //            NSLog(@"res===%@",responseData);
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark - 获取商铺余额明细
- (void)getMerchantsBillListsResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * shop_id = DEF_GET_OBJECT(@"shopid");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"merchants_id":shop_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_id":shop_id};
    
    [self requestWithType:POST andUrl:@"/Api/getMerchantsBillLists" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 获取用户余额明细
- (void)getUserBillListsResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getUserBillLists" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];

            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 绑定银行卡
- (void)addBingBankCardResultWithBank_card_account_holder:(NSString *)bank_card_account_holder WithBank_card_no:(NSString *)bank_card_no WithBank_card_phone:(NSString *)bank_card_phone WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"bank_card_account_holder":bank_card_account_holder,@"bank_card_no":bank_card_no,@"bank_card_phone":bank_card_phone};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"bank_card_account_holder":bank_card_account_holder,@"bank_card_no":bank_card_no,@"bank_card_phone":bank_card_phone};
    
    [self requestWithType:POST andUrl:@"/Api/addBingBankCard" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 获取商铺余额明细
- (void)getBingBankListsResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getBingBankLists" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 发起提现
- (void)initiateWithdrawalResultWithInfo:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:4];
    
    [muDict setObject:user_id forKey:@"user_id"];
    [muDict setObject:dateStr forKey:@"timeStamp"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/initiateWithdrawal" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark - 获取店铺相册
- (void)getMerchantsPhotoAlbumListsWithShop_id:(NSString *)shop_id WithIs_merchants_get:(NSString *)is_merchants_get ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict;
    if (is_merchants_get) {
        
        dict = @{@"timeStamp":dateStr,@"merchants_id":shop_id,@"is_merchants_get":is_merchants_get};
    }else{
        
        dict = @{@"timeStamp":dateStr,@"merchants_id":shop_id};
    }
    
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict;
    if (is_merchants_get) {
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_id":shop_id,@"is_merchants_get":is_merchants_get};
    }else{
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_id":shop_id};
    }
    
    [self requestWithType:POST andUrl:@"/Api/getMerchantsPhotoAlbumLists" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark - 删除店铺相册
- (void)deleteMerchantsPhotoAlbumWithShop_id:(NSString *)shop_id WithID:(NSString *)ID ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":ID,@"merchants_id":shop_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":ID,@"merchants_id":shop_id};
    
    [self requestWithType:POST andUrl:@"/Api/deleteMerchantsPhotoAlbum" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 添加店铺相册
- (void)addMerchantsPhotoAlbumWithShop_id:(NSString *)shop_id WithImg:(NSString *)img ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"img":img,@"merchants_id":shop_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"img":img,@"merchants_id":shop_id};
    
    [self requestWithType:POST andUrl:@"/Api/addMerchantsPhotoAlbum" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark - 取消订单
- (void)cancelGoodsOrderWithGood_id:(NSString *)good_id ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":good_id,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"id":good_id,@"user_id":user_id,@"sign":sign};
    
    [self requestWithType:POST andUrl:@"/Api/cancelGoodsOrder" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 删除订单
- (void)deleteGoodsOrderWithGood_id:(NSString *)good_id ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":good_id,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"id":good_id,@"user_id":user_id,@"sign":sign};
    
    [self requestWithType:POST andUrl:@"/Api/deleteGoodsOrder" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 获取用户评价商品规则
- (void)getMerchantsCommentsRulesResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];

    NSDictionary * dict = @{@"timeStamp":dateStr};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    
    [self requestWithType:POST andUrl:@"/Api/getMerchantsCommentsRules" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark - 用户评价商品
- (void)commentsMerchantsGoodsWithDictory:(NSDictionary *)dict ResultWithBlock:(result)finishBlock{

    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];

    [muDict setObject:dateStr forKey:@"timeStamp"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/commentsMerchantsGoods" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -查询用户身份
- (void)byPhoneGetIdentityWithPhone:(NSString *)phone ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"phone":phone};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"phone":phone};
    
    [self requestWithType:POST andUrl:@"/Api/byPhoneGetIdentity" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -获取用户系统通知
- (void)getUserNoticeWithUser_id:(NSString *)user_id ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getUserNotice" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取用户系统是否已读
- (void)judgeUserNoticeWithUser_id:(NSString *)user_id ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/judgeUserNotice" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -更新用户通知状态 未读->已读
- (void)updateUserNoticeWithNoti_id:(NSString *)noti_id ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":noti_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":noti_id};
    
    [self requestWithType:POST andUrl:@"/Api/updateUserNotice" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -设置开团推送
- (void)setOpenGroupRemindedWithGoods_id:(NSString *)goods_id ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    NSString * user_id = DEF_GET_OBJECT(@"id");
    NSDictionary * dict = @{@"timeStamp":dateStr,@"goods_id":goods_id,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"goods_id":goods_id,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/setOpenGroupReminded" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取分享信息
- (void)getUserShareSystemWithCategory_id:(NSString *)category_id ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];

    NSDictionary * dict = @{@"timeStamp":dateStr,@"category_id":category_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"category_id":category_id};
    
    [self requestWithType:POST andUrl:@"/Api/getUserShareSystem" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取商品订单详情
- (void)getGoodsOrderInfoWithOrder_id:(NSString *)order_id ResultWithBlock:(result)finishBlock{
        
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":order_id,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":order_id,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getGoodsOrderInfo" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -关注用户
- (void)attentionUseroWithUser_id:(NSString *)attention_user_id ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"attention_user_id":attention_user_id,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"attention_user_id":attention_user_id,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/attentionUser" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -取消关注
- (void)cancelAttentionUserUser_id:(NSString *)attention_user_id ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"attention_user_id":attention_user_id,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"attention_user_id":attention_user_id,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/cancelAttentionUser" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取关注列表
- (void)getAttentionUserUser_id:(NSString *)attention_user_id WithSearch:(NSString *)search ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict;
    if (search) {
        
        dict = @{@"timeStamp":dateStr,@"view_user_id":attention_user_id,@"user_id":user_id,@"search":search};
    }else{
        
       dict = @{@"timeStamp":dateStr,@"view_user_id":attention_user_id,@"user_id":user_id};
    }
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict;
    if (search) {
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"view_user_id":attention_user_id,@"user_id":user_id,@"search":search};
    }else{
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"view_user_id":attention_user_id,@"user_id":user_id};
    }
    
    [self requestWithType:POST andUrl:@"/Api/getAttentionUser" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}
#pragma mark -获取粉丝列表
- (void)getFansUserUser_id:(NSString *)attention_user_id WithSearch:(NSString *)search ResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict;
    if (search) {
        
        dict = @{@"timeStamp":dateStr,@"view_user_id":attention_user_id,@"user_id":user_id,@"search":search};
    }else{
        
        dict = @{@"timeStamp":dateStr,@"view_user_id":attention_user_id,@"user_id":user_id};
    }
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict;
    if (search) {
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"view_user_id":attention_user_id,@"user_id":user_id,@"search":search};
    }else{
        
        resDict = @{@"timeStamp":dateStr,@"sign":sign,@"view_user_id":attention_user_id,@"user_id":user_id};
    }
    
    [self requestWithType:POST andUrl:@"/Api/getFansUser" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -常见问题
- (void)getCommonProblemsListResultWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    
    [self requestWithType:POST andUrl:@"/Api/getCommonProblemsList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取默认时间
- (void)getMerchantsGoodsDefaultTimeWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * merchants_id = DEF_GET_OBJECT(@"shopid");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"merchants_id":merchants_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_id":merchants_id};
    
    [self requestWithType:POST andUrl:@"/Api/getMerchantsGoodsDefaultTime" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取用户动态列表
- (void)getUserDynamicWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getUserDynamic" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -发布用户动态
- (void)initiateDynamicWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/InitiateDynamic" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -评论动态
- (void)InitiateDynamicCommentWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/InitiateDynamicComment" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -获取动态评论详情更多
- (void)getDynamicCommentsInfoWithDynamic_id:(NSString *)ID WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":ID};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":ID};
    
    [self requestWithType:POST andUrl:@"/Api/getDynamicCommentsInfo" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -点赞动态
- (void)initiateDynamicPraiseWithID:(NSString *)ID WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"dynamic_id":ID,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"dynamic_id":ID,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/InitiateDynamicPraise" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}
#pragma mark -取消点赞动态
- (void)deleteDynamicPraiseWithID:(NSString *)ID WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"dynamic_id":ID,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"dynamic_id":ID,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/deleteDynamicPraise" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -创建社团
- (void)createGroupWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"group_user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/createGroup" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取用户社团列表
- (void)getUserGroupListWithUser_idt:(NSString *)user_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getUserGroupList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -判断用户是否创建社团
- (void)judgeUserIsCreateGroupWithUser_idt:(NSString *)user_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/judgeUserIsCreateGroup" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取随机推荐社团列表
- (void)getRandGroupListWithUser_idt:(NSString *)user_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getRandGroupList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}


#pragma mark -获取社团详情
- (void)getGroupInfoWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/getGroupInfo" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取社团成员列表
- (void)getGroupMembersListWithGroup_id:(NSString *)group_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"group_id":group_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"group_id":group_id};
    
    [self requestWithType:POST andUrl:@"/Api/getGroupMembersList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -邀请用户加入社团
- (void)invitationJoinGroupWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"operation_user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/invitationJoinGroup" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -邀请用户加入社团
- (void)addTopicWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * promulgator_type = @"2";
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:promulgator_type forKey:@"promulgator_type"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/addTopic" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -获取话题列表
- (void)getTopicListWithPromulgator_id:(NSString *)promulgator_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"get_type":@"2",@"promulgator_id":promulgator_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"get_type":@"2",@"promulgator_id":promulgator_id};
    
    [self requestWithType:POST andUrl:@"/Api/getTopicList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -发布社团公告
- (void)addGroupNoticeWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/addGroupNotice" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -获取社团公告列表
- (void)getGroupNoticeListWithGroup_id:(NSString *)group_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"group_id":group_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"group_id":group_id};
    
    [self requestWithType:POST andUrl:@"/Api/getGroupNoticeList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -编辑社团公告
- (void)editGroupNoticeWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/editGroupNotice" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -删除社团公告
- (void)deleteGroupNoticeWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/deleteGroupNotice" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}


#pragma mark -修改社团资料
- (void)updateGroupWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/updateGroup" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -上传社团相册图片
- (void)addGroupPhotoWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/addGroupPhoto" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}
#pragma mark -删除社团相册图片
- (void)deleteGroupPhotoWithID:(NSString *)ID WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":ID,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":ID,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/deleteGroupPhoto" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}
#pragma mark -获取社团相册列表
- (void)getGroupPhotoListWithGroup_id:(NSString *)group_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"group_id":group_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"group_id":group_id};
    
    [self requestWithType:POST andUrl:@"/Api/getGroupPhotoList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}


#pragma mark -上传社团相册图片
- (void)addGroupActivityGoodsWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/addGroupActivityGoods" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取社团活动商品列表
- (void)getGroupActivityGoodsListWithGroup_id:(NSString *)group_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"group_id":group_id,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"group_id":group_id,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getGroupActivityGoodsList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取已参加的社团活动商品列表
- (void)getMyGroupActivityGoodsWithGroup_id:(NSString *)group_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"group_id":group_id,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"group_id":group_id,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getMyGroupActivityGoods" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}


#pragma mark -获取社团活动商品详情
- (void)getGroupActivityGoodsInfoWithID:(NSString *)ID WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":ID,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":ID,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getGroupActivityGoodsInfo" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -获取社团通知
- (void)getGroupInformWithUser_id:(NSString *)user_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getGroupInform" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}


#pragma mark -购买商铺商品
- (void)buyMerchantsGoodsWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"goods_order_user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/buyMerchantsGoods" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -更改社团通知状态
- (void)updateGroupInformWithID:(NSString *)ID WithAudit_status:(NSString *)status WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"id":ID,@"audit_status":status};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"id":ID,@"audit_status":status};
    
    [self requestWithType:POST andUrl:@"/Api/updateGroupInform" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取社团通知详情
- (void)getGroupInformInfoWithID:(NSString *)ID WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"id":ID};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"id":ID};
    
    [self requestWithType:POST andUrl:@"/Api/getGroupInformInfo" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -搜索联系人
- (void)searchContactsWithSearch_str:(NSString *)search WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"search_str":search};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"search_str":search};
    
    [self requestWithType:POST andUrl:@"/Api/searchContacts" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -用户申请加入社团
- (void)applyForJoinGroupWithGroup_id:(NSString *)group_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"group_id":group_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"group_id":group_id};
    
    [self requestWithType:POST andUrl:@"/Api/applyForJoinGroup" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -设置社团消息免打扰
- (void)setGroupNodisturbWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/setGroupNodisturb" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -解散社团
- (void)deleteGroupWithGroup_id:(NSString *)group_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"group_id":group_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"group_id":group_id};
    
    [self requestWithType:POST andUrl:@"/Api/deleteGroup" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -退出社团
- (void)exitGroupWithGroup_id:(NSString *)group_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"group_id":group_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"group_id":group_id};
    
    [self requestWithType:POST andUrl:@"/Api/exitGroup" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -屏蔽用户动态
- (void)shieldUserDynamicWithShield_user_id:(NSString *)shield_user_id WithBlock:(result)finishBlock{

    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"shield_user_id":shield_user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"shield_user_id":shield_user_id};
    
    [self requestWithType:POST andUrl:@"/Api/shieldUserDynamic" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -举报用户动态
- (void)reportUserDynamicWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/reportUserDynamic" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -社长移除社团成员
- (void)deleteGroupMembersWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/deleteGroupMembers" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -取消社团活动商品
- (void)deleteGroupActivityGoodsWithID:(NSString *)ID WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"activity_id":ID};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"activity_id":ID};
    
    [self requestWithType:POST andUrl:@"/Api/deleteGroupActivityGoods" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -禁言社团成员
- (void)bannedGroupMemberWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"operation_user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/bannedGroupMember" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -搜索用户
- (void)selectUserWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/selectUser" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取随机推荐社团列表
- (void)getRandGroupListWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getRandGroupList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -搜索社团
- (void)selectGroupWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/selectGroup" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取话题评论列表
- (void)getTopicCommentListWithTopic_id:(NSString *)topic_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"topic_id":topic_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"topic_id":topic_id};
    
    [self requestWithType:POST andUrl:@"/Api/getTopicCommentList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}


#pragma mark -用户评论话题
- (void)userCommentTopicWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/userCommentTopic" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -搜索社团成员列表
- (void)selectGroupMembersWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/selectGroupMembers" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取社团成员禁言和免打扰状态
- (void)getGroupMemberBannedAndTouserWithGroup_jg_gid:(NSString *)group_jg_gid WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"group_jg_gid":group_jg_gid,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"group_jg_gid":group_jg_gid,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getGroupMemberBannedAndTouser" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}
#pragma mark -获取社团今日活动
- (void)getGroupTodayActivityWithGroup_jg_gid:(NSString *)group_jg_gid WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"group_jg_gid":group_jg_gid};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"group_jg_gid":group_jg_gid};
    
    [self requestWithType:POST andUrl:@"/Api/getGroupTodayActivity" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}
#pragma mark -获取社团今日话题
- (void)getGroupTodayTopicWithGroup_jg_gid:(NSString *)group_jg_gid WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"group_jg_gid":group_jg_gid};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"group_jg_gid":group_jg_gid};
    
    [self requestWithType:POST andUrl:@"/Api/getGroupTodayTopic" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取话题详情
- (void)getTopicInfoWithID:(NSString *)ID WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":ID};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":ID};
    
    [self requestWithType:POST andUrl:@"/Api/getTopicInfo" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取动态评论列表
- (void)getDynamicCommentsWithID:(NSString *)dynamic_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"dynamic_id":dynamic_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"dynamic_id":dynamic_id};
    
    [self requestWithType:POST andUrl:@"/Api/getDynamicComments" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取话题评论详情更多
- (void)getTopicCommentInfoWithTopic_id:(NSString *)topic_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":topic_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":topic_id};
    
    [self requestWithType:POST andUrl:@"/Api/getTopicCommentInfo" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -查看关注状态
- (void)checkAttentionStatusWithAttention_user_id:(NSString *)attention_user_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"attention_user_id":attention_user_id,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"attention_user_id":attention_user_id,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/checkAttentionStatus" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}

#pragma mark -删除社团通知
- (void)deleteGroupInformWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"inform_user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/deleteGroupInform" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -查看社团是否存在
- (void)checkGroupStatusWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];

    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/checkGroupStatus" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}


#pragma mark -获取屏蔽用户列表
- (void)getShieldUserListWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getShieldUserList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}
#pragma mark -取消屏蔽
- (void)deleteShieldUserWithUser_id:(NSString *)user_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/deleteShieldUser" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -删除用户动态
- (void)deleteDynamicWithID:(NSString *)ID WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"id":ID};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"id":ID};
    
    [self requestWithType:POST andUrl:@"/Api/deleteDynamic" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取我发布的动态列表
- (void)getMyDynamicDict:(NSDictionary *)dict WithBlock:(result)finishBlock{    
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/getMyDynamic" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取积分商城列表
- (void)getIntegralShopListWithType:(NSString *)type WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"type":type};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"type":type};
    
    [self requestWithType:POST andUrl:@"/Api/getIntegralShopList" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取用户积分列表
- (void)getUserIntegralWithDate_time:(NSString *)date_time WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"date_time":date_time,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"date_time":date_time,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/getUserIntegral" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -签到积分
- (void)signIntegralWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/signIntegral" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -积分兑换
- (void)integralExchangeWithIntegral_rules_id:(NSString *)integral_rules_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"integral_rules_id":integral_rules_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"integral_rules_id":integral_rules_id};
    
    [self requestWithType:POST andUrl:@"/Api/integralExchange" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -批量修改个人信息
- (void)updateUserInfoAllWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/updateUserInfoAll" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -shareIntegral
- (void)shareIntegralWithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id};
    
    [self requestWithType:POST andUrl:@"/Api/shareIntegral" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -根据手机号获取用户ID
- (void)getUserIdByPhoneWithPhone:(NSString *)phone WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"phone":phone};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"phone":phone};
    
    [self requestWithType:POST andUrl:@"/Api/getUserIdByPhone" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}


#pragma mark -检测商品核销状态
- (void)monitorMerchantsGoodsBarcodeWithDict:(NSDictionary *)dict WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSMutableDictionary * muDict = [[NSMutableDictionary alloc] initWithCapacity:6];
    
    [muDict setObject:dateStr forKey:@"timeStamp"];
    [muDict setObject:user_id forKey:@"user_id"];
    
    NSArray * allkeys = [dict allKeys];
    
    for (int i = 0; i < allkeys.count; i++)
    {
        NSString * key = [allkeys objectAtIndex:i];
        
        //如果你的字典中存储的多种不同的类型,那么最好用id类型去接受它
        NSString * obj  = [dict objectForKey:key];
        [muDict setObject:obj forKey:key];
    }
    
    NSString * sign = [self signStr:muDict.copy];
    
    //    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign};
    [muDict setObject:sign forKey:@"sign"];
    
    [self requestWithType:POST andUrl:@"/Api/monitorMerchantsGoodsBarcode" andParameters:muDict.copy andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
    
}


#pragma mark -获取同类商品列表
- (void)getSimilarMerchantsGoodsListsWithGoods_id:(NSString *)goods_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"goods_id":goods_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"goods_id":goods_id};
    
    [self requestWithType:POST andUrl:@"/Api/getSimilarMerchantsGoodsLists" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

#pragma mark -获取用户余额明细详情
- (void)getUserBillInfoWithBill_id:(NSString *)bill_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * user_id = DEF_GET_OBJECT(@"id");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"user_id":user_id,@"bill_id":bill_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"user_id":user_id,@"bill_id":bill_id};
    
    [self requestWithType:POST andUrl:@"/Api/getUserBillInfo" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}
#pragma mark -获取商铺余额明细详情
- (void)getMerchantsBillInfoWithBill_id:(NSString *)bill_id WithBlock:(result)finishBlock{
    
    //获取当前时间日期
    NSDate *date=[NSDate date];
    NSDateFormatter *format1=[[NSDateFormatter alloc] init];
    [format1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateStr;
    dateStr=[format1 stringFromDate:date];
    
    NSString * shop_id = DEF_GET_OBJECT(@"shopid");
    
    NSDictionary * dict = @{@"timeStamp":dateStr,@"merchants_id":shop_id,@"bill_id":bill_id};
    
    NSString * sign = [self signStr:dict];
    
    NSDictionary * resDict = @{@"timeStamp":dateStr,@"sign":sign,@"merchants_id":shop_id,@"bill_id":bill_id};
    
    [self requestWithType:POST andUrl:@"/Api/getMerchantsBillInfo" andParameters:resDict andTimeOut:10 resultWithBlock:^(BOOL success, id responseData) {
        
        if (success)
        {
            NSError *error;
            
            NSDictionary *result = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
            NSInteger code = [result[@"code"] integerValue];
            
            if (code == 200)
            {
                finishBlock(YES,result);
                
            }else{
                finishBlock(NO,result);
            }
        }
        else
        {
            finishBlock(NO,@"请求失败");
        }
    }];
}

//               =============================分割线=========================================


- (NSString *)signStr:(NSDictionary *)dict{
    
    NSArray *keyArray = [dict allKeys];
    
    //定义一个排序数组，存储排序好之后的key值
    NSArray *sortArray = [keyArray sortedArrayUsingComparator:^NSComparisonResult(id  _Nonnull obj1, id  _Nonnull obj2) {
        return [obj1 compare:obj2 options:NSNumericSearch];
    }];
    
    //这时我们再创建一个数组，来按升序存储key对应的Value，通过遍历sortArray的方法
    NSMutableArray *valueArray = [NSMutableArray array];
    for (NSString *sortString in sortArray) {
        [valueArray addObject:[dict objectForKey:sortString]];
    }
    //    现在我们有两个数组，分别对应升序排序的key和value，所以再创建一个keyValue的数组来存储每一个key和value的格式
    //    NSMutableArray *signArray = [NSMutableArray array];
    //    for (int i = 0; i < sortArray.count; i++) {
    //        NSString *keyValueStr = [NSString stringWithFormat:@"%@:%@",sortArray[i],valueArray[i]];
    //        [signArray addObject:keyValueStr];
    //    }
    
    //最后的一步，就是用“,”把每个字符串拼接起来
    NSString *sign = [valueArray componentsJoinedByString:@""];
    
    NSString * resStr = [NSString stringWithFormat:@"%@NDQ0NTlmMDk4MTU3NTg3NzFiZTFlZmQwNDFjNzA0ZGMyYWY0NzU5ZQ==",sign];
    
//    NSLog(@"res==%@",resStr);
    NSString *signStr = [self md5:resStr];
    
    NSString * baseStr = [self encode:signStr];
    
    return baseStr;
}

- (NSString *) md5:(NSString *) str
{
    const char *cStr = [str UTF8String];
    unsigned char result[16];
    CC_MD5(cStr, strlen(cStr), result); // This is the md5 call
    return [NSString stringWithFormat:
            @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
            result[0], result[1], result[2], result[3],
            result[4], result[5], result[6], result[7],
            result[8], result[9], result[10], result[11],
            result[12], result[13], result[14], result[15]
            ];
}

- (NSString *)encode:(NSString *)string
{
    //先将string转换成data
    NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
    
    NSData *base64Data = [data base64EncodedDataWithOptions:0];
    
    NSString *baseString = [[NSString alloc]initWithData:base64Data encoding:NSUTF8StringEncoding];
    
    return baseString;
}



@end
